﻿using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.Resolve;
using JetBrains.ReSharper.Psi.Xaml.Impl.Resolve;

namespace GammaJul.ReSharper.GammaXaml.Psi.Resolve {

	public sealed class NonVoidReturnTypeFilter : SimpleSymbolFilterWithErrorType {
		
		public static readonly NonVoidReturnTypeFilter Instance = new NonVoidReturnTypeFilter();

		public override bool Accepts(IDeclaredElement declaredElement, ISubstitution substitution) {
			var parametersOwner = declaredElement as IParametersOwner;
			return parametersOwner != null && !parametersOwner.ReturnType.IsVoid();
		}

		private NonVoidReturnTypeFilter()
			: base(XamlResolveErrorType.BAD_SIGNATURE) {
		}
	}

}